home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / PowerPC / vbcc / Examples / cgfxtest / fbaddr.c next >
Encoding:
C/C++ Source or Header  |  1998-08-02  |  1.6 KB  |  55 lines

  1. #include <stdio.h>
  2. #include <exec/libraries.h>
  3. #include <intuition/intuition.h>
  4. #include <intuition/screens.h>
  5. #include <cybergraphics/cybergraphics.h>
  6. #include <clib/exec_protos.h>
  7. #include <clib/intuition_protos.h>
  8. #include <cybergraphics/cybergraphics_protos.h>
  9.  
  10. struct Library *CyberGfxBase;
  11. struct Library *IntuitionBase;
  12.  
  13.  
  14. main()
  15. {
  16.   struct Screen *testscreen;
  17.   UBYTE *fb;  /* the frame buffer */
  18.   ULONG DispID;
  19.   int x;
  20.  
  21.   if (!(IntuitionBase = OpenLibrary("intuition.library",39))) {
  22.     printf("Can't open intuition.library v39!\n");
  23.     exit(0);
  24.   }
  25.   if (CyberGfxBase = OpenLibrary("cybergraphics.library",40)) {
  26.     /* pops up a screen mode requester */
  27.     if (DispID = CModeRequestTags(NULL,TAG_DONE)) {
  28.       if (testscreen = OpenScreenTags(
  29.           NULL,
  30.           SA_Left,0,
  31.           SA_Top,0,
  32.           SA_Width,GetCyberIDAttr(CYBRIDATTR_WIDTH,DispID),
  33.           SA_Height,GetCyberIDAttr(CYBRIDATTR_HEIGHT,DispID),
  34.           SA_Depth,GetCyberIDAttr(CYBRIDATTR_DEPTH,DispID),
  35.           SA_Quiet,TRUE,
  36.           SA_Type,CUSTOMSCREEN,
  37.           SA_DisplayID,DispID,
  38.           TAG_DONE)) {
  39.         fb = (UBYTE *)GetCyberMapAttr(testscreen->RastPort.BitMap,
  40.                                       CYBRMATTR_DISPADR);
  41.         printf("Frame Buffer = 0x%08lx\n",(unsigned long)fb);
  42.         /* write a test pattern */
  43.         for (x=0; x<=0xff; x++)
  44.           *fb++ = x;
  45.         Delay(250);  /* wait 5s */
  46.         CloseScreen(testscreen);
  47.       }
  48.     }
  49.     CloseLibrary(CyberGfxBase);
  50.   }
  51.   else
  52.     printf("Can't open cybergraphics.library v40!\n");
  53.   CloseLibrary(IntuitionBase);
  54. }
  55.